package com.css.apps.base.common.tree.action;

import net.sf.json.JSONArray;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.common.tree.service.TreeMan;
import com.css.core.configuration.Environment;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.webbase.webwork.action.UserAction;
import com.opensymphony.xwork.Action;

@SuppressWarnings("serial")
public class GetPostTreeJson extends UserAction {

	private static Log log = LogFactory.getLog(GetPostTreeJson.class);

	private String parentId;
	private String checkIds;

	public GetPostTreeJson() {
	}

	@Override
	protected String userGo() {
		try {
			JSONArray ja = TreeMan.getPostTree(checkIds);
			result = ja.toString();
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}

	public String getCheckIds() {
		return checkIds;
	}

	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

}